// components/chart-nightingale/index.js
import { behavior as computedBehavior} from 'miniprogram-computed'
import { virtualHostConfig } from '@/behavior/virtualHost'

Component({
  ...virtualHostConfig({
    behaviors: [computedBehavior]
  }),

  /**
   * 组件的属性列表
   */
  properties: {
    width: {
      type: String,
      value: '100%'
    },
    height: {
      type: String,
      value: '400rpx'
    },
    data: {
      type: Array,
      value: []
    },
    config: {
      type: Object,
      value: {}
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },
  
  computed: {
    option(_data) {
      return {
        series: [{
          type: 'pie',
          center: ['50%', '50%'],
          roseType: 'area',
          itemStyle: {
            borderRadius: 8
          },
          ...(_data.config || {}),
          data: _data.data || []
        }]
      }
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {

  }
})